<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="renderer" content="webkit">
	<title>付临门云商宝会员信息查询</title>
	<link rel="icon" href="favicon.ico" type="image/x-icon"/>
	<!-- 当前页面样式 -->
	<link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
	<!-- 当前页面样式 END -->
	<script type="text/javascript" src="<c:url value="/js/jquery-1.3.2.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
	<script type='text/javascript' src='<s:url value="/js/pageAjax.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/js/querySon.js"/>'></script>
	<script type="text/javascript">
	$(document).ready(function() {
		$("#allotToOp").click(
			function() {
				var dd = $("input[name=multi_sel]:checked");
				var accountNoStr= "";
				if(dd.length == 0){
					alert("请选择云商宝会员");
					return false;
				}else if(dd.length > 20){
					alert("最多只能分配二十个云商宝会员！");
					return false;
				}else{
					dd.each(function(){
						accountNoStr = accountNoStr + $(this).val() + ",";
					});
					accountNoStr = accountNoStr.substring(0,accountNoStr.length-1);
					var allotOprNo = $("#allotOprNo").val();
						$.ajax({
							url:"<%=basePath%>/ysbMerDetailInfo/allotYsbOp.ct",
							type:"post",
							data:{"authIdList":accountNoStr,"allotOprNo":allotOprNo},
							dataType:"json",
							success:function(result){
								var msgCode = result.msgCode;
								if(msgCode == "0000"){
									var rsList = result.list;
									if(rsList.length > 0){
										var rsStr = "";
										for(var i = 0;i<rsList.length;i++){
											rsStr = rsStr + rsList[i] + ",";
										}
										rsStr = rsStr.substring(0,rsStr.length-1);
										alert("部分用户实名信息已被领取，成功分配"+(dd.length-rsList.length)+"个");
										
									}else{
										alert("分配成功！");
									}
									window.location.href="<%=basePath%>/ysbMerDetailInfo/ysbMerDetailists.ct";
								}else{
									alert("分配人员不存在，请核实！");
								}
								
							},error:function(){
								alert("未知错误！");
							}
						});
					}
		});
	});
	function queryForm(obj){
		$("#"+obj.id).attr("disabled",true);
		$("#querymerForm").attr("action","<%=basePath%>/ysbMerDetailInfo/ysbMerDetailists.ct");
		$("#querymerForm").submit();		
	}
	
	//导出
	function exportSubmit(){
		var minDate = $.trim($("#minDateysb").val());
		var maxDate = $.trim($("#maxDateysb").val());
		if(!minDate || !maxDate){
			alert("请选择时间范围");
			return false;
		}
		$("#querymerForm").attr("action","<%=basePath%>/ysbMerDetailInfo/exportYsbMerDetailist.ct");
		$("#querymerForm").submit();
		$(this).attr("disabled","true");
	}
	
	function toShowJsp(id){
		$("#querymerForm").attr("action","<%=basePath%>/operatorAuthCheck/operatorAuthInfoShow.ct?detailId="+id);
		$("#querymerForm").submit();
	}
	
	//解限
	function toReleaseLimitJsp(id){
		$("#querymerForm").attr("action","<%=basePath%>/operatorAuthCheck/operatorAuthReleaseLimit.ct?detailId="+id);
		$("#querymerForm").submit();
	}
	
	function toUpdateJsp(id){
		$("#querymerForm").attr("action","<%=basePath%>/operatorAuthCheck/operatorAuthInfoShow.ct?detailId="+id+"&updateFlag="+0);
		$("#querymerForm").submit();
	}
	
	function changeNum(){
		var num = $("#collarNum").val();
		$("input[name='multi_sel']").each(function(i){ 
			$(this).removeAttr("checked"); 
		});
		if(num>0){
			$("input[name='multi_sel']").each(function(i){ 
				 if(i<num){
					 $(this).attr("checked","true");
				 }
			});
		}
	}
	
	</script>
</head>
<body>
<s:form id="querymerForm" action="" method="post" theme="simple">
<s:hidden id="isAllowToReleLimit" name="isAllowToReleLimit" value="%{#request.isAllowToReleLimit}"/>
<table class="tb">
	<tbody>
		<tr class="tb-line">
			<td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
		</tr>
		<tr class="tb-line">
			<td class="tb-td" colspan="4"><div class="tb-h3">云商宝会员实名信息查询</div></td>
		</tr>
		<tr class="tb-line">
			<td align="right" class="tb-td">
				<div class="tb-h4">会员手机号：</div>
			</td>
			<td class="tb-td">
				<label class="tb-input-normal">
					<s:textfield  name="searchCondition.mobile" />
				</label>
			</td>
			<td align="right" class="tb-td">
				<div class="tb-h4">会员姓名：</div>
			</td>
			<td class="tb-td">
				<label class="tb-input-normal">
					<s:textfield  name="searchCondition.merName" maxlength="20"/>
				</label>
			</td>
		</tr>
		<tr class="tb-line">
			<td align="right" class="tb-td">
				<div class="tb-h4">身份证号码：</div>
			</td>
			<td class="tb-td">
				<label class="tb-input-normal">
					<s:textfield  name="searchCondition.pid" maxlength="20"/>
				</label>
			</td>
			<td align="right" class="tb-td">
				<div class="tb-h4">操作员：</div>
			</td>
			<td class="tb-td">
				<label class="tb-input-normal">
					<s:textfield  name="searchCondition.oprNo" maxlength="20"/>
				</label>
			</td>
		</tr>
		<tr class="tb-line">
			<td align="right" class="tb-td">
				<div class="tb-h4">商户状态：</div>
			</td>
			<td class="tb-td">
				<label class="tb-input-mini">
					<s:select id="merStatus" list="#{'99':'请选择状态','0':'未领取','3':'待审核','1':'审核通过','2':'驳回','4':'限制','5':'解限' }" name="searchCondition.status" />
				</label>
			</td>
			<td align="right" class="tb-td">
				<div class="tb-h4">时间：</div>
			</td>
			<td class="tb-td">
				<label class="tb-input-normal">
					<s:textfield id="minDateysb" onfocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" name="searchCondition.minDate" />
				</label>
				-
				<label class="tb-input-normal">
					<s:textfield id="maxDateysb" onfocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" name="searchCondition.maxDate" />
				</label>
			</td>
		</tr>
		<tr class="tb-line">
			<td align="right" class="tb-td">
				<div class="tb-h4">身份证有效期是否输入：</div>
			</td>
			<td class="tb-td">
				<label class="tb-input-mini">
					<s:select id="idCardStatus" list="#{'99':'请选择状态','1':'是','0':'否'}" name="searchCondition.idCardStatus" />
				</label>
			</td>
		</tr>
		<tr class="tb-line">
			<td class="tb-td line-submit" align="right" colspan="4">
				<label class="tb-input-submit">
					<input type="button" value="查询" id="queryBtn" onclick="queryForm(this)"/>
				</label>
				<label class="tb-input-submit">
					<input type="reset" value="取消"/>
				</label>
				<s:if test="op.roleType==\"13\"||op.roleType==\"00\"">
					<label class="tb-input-submit">
						<input id="szPower" type="button" value="导 出" onclick="return exportSubmit();"/>
					</label>
				</s:if>
				<s:if test="#request.isAllot==\"1\"">
					<label class="tb-input-submit">
						<input id="allotToOp" type="button" value="分配"/>
					</label>
					<s:textfield id="allotOprNo"  name="allotOprNo" maxlength="20"/>
					<s:select onchange="changeNum()" id="collarNum" list="#{'5':'5','10':'10','15':'15','20':'20'}" theme="simple" headerKey="0" headerValue="请选择分配数量"></s:select>
				</s:if>
			</td>
		</tr>
		<tr class="tb-line">
			<td class="tb-td line-submit" align="center" colspan="4">
				<font color="red" id="msgInfo"><s:actionmessage/>
					<s:if test="#request.COUNT != null">
						统计：当前查询条件共计[<font color="red"><s:property value="#request.COUNT"/></font>]条数据
					</s:if>
				</font>
			</td>
		</tr>
		<s:if test="#request.searchRsList != null && #request.searchRsList.size>0 ">
			<tr class="tb-line">
				<td class="tb-td paging"  align="left" colspan="4"> 
						<page:pageCount max_pages="11" totalPage="${requestScope.totalPage}"
						currentPage="${requestScope.currentPage}"
						action="${rootPath}/ysbMerDetailInfo/ysbMerDetailists.ct?currentPage=" />
				</td>
			</tr>
		</s:if>
	</tbody>
</table>
</s:form>
<div class="big-tb">
	<table class="tb" style="width: 100%;">
		<thead>
			<tr class="tb-line">
				<th class="tb-th" colspan="10">信息列表</th>
			</tr>
			<tr class="tb-line bg-gray">
					<th class="tb-th">选择</th>
					<th class="tb-th">会员手机号</th>
					<th class="tb-th">真实姓名</th>
					<th class="tb-th">身份证号码</th>
					<th class="tb-th">提交时间</th>
					<th class="tb-th">领件时间</th>
					<th class="tb-th">审核时间</th>
					<th class="tb-th">操作员</th>
					<th class="tb-th">审核状态</th>
					<th class="tb-th">操作</th>
			</tr>
		</thead>
	<tbody>
		<s:iterator value="#request.searchRsList" status="stat" id="sh">
			<tr class="tb-line" >
					<td align="center" class="tb-td">
						<input  name="multi_sel" value="<s:property value="#sh.detailId"/>" type="checkbox" />
			        </td>
					<td class="tb-td"><s:property value="#sh.mobile"/></td>
					<td class="tb-td"><s:property value="#sh.realName"/></td>
					<td class="tb-td"><s:property value="#sh.pid"/></td>
					<td class="tb-td"><s:property value="#sh.CreateDate"/></td>
					<td class="tb-td"><s:property value="#sh.receiveDate"/></td>
					<td class="tb-td"><s:property value="#sh.auditDate"/></td>
					<td class="tb-td"><s:property value="#sh.oprNo"/></td>
					<td class="tb-td"><s:property value="#sh.status"/></td>
					<td class="tb-td" align="center">
						<a href="javascript:void(0)" onclick="toShowJsp(<s:property value="#sh.detailId"/>)" >查看</a>
						<s:if test="#request.isAllowToReleLimit==\"1\" && #sh.status =='限制' && #sh.ext5 == \"0\"">
							<a href="javascript:void(0)" onclick="toReleaseLimitJsp(<s:property value="#sh.detailId"/>)" >|&nbsp;解限</a>
						</s:if>
						<s:if test="#request.isUpdate==\"1\" && #sh.status !='未领取'">
							<a href="javascript:void(0)" onclick="toUpdateJsp(<s:property value="#sh.detailId"/>)" >|&nbsp;修改</a>
						</s:if>
						
					</td>
			</tr>
		</s:iterator>
	</tbody>
	</table>
</div>
 <s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>